import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/sys-admin/index',//重定向
    children:[
      {
        path: '/sys-admin/index',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/SystemAdminIndex.vue')
      },
      {
        path: '/sys-admin/admin/add-new',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AdminAddNewView.vue')
      },
      {
        path: '/sys-admin/admin/list',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AdminListView')
      },
      {
        path: '/sys-admin/album/add-new',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AlbumAddNewView.vue')
      },
      {
        path: '/sys-admin/albums',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AlbumListView')
      },
      {
        path: '/sys-admin/brand/add-new',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/BrandAddNewView.vue')
      },
      {
        path: '/sys-admin/brands',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/BrandListView.vue')
      },
      {
        path: '/sys-admin/attribute-template/add-new',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AttributeTemplateAddNewView')
      },
      {
        path: '/sys-admin/attribute-template',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AttributeTemplateListView')
      },
      {
        path: '/sys-admin/categories/add-new',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/CategoryAddNewView')
      },
      {
        path: '/sys-admin/categories',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/CategoryListView')
      },
      {
        path: '/sys-admin/attributes/add-new',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AttributeAddNewView')
      },
      {
        path: '/sys-admin/attributes',
        component: () => import(/* webpackChunkName: "about" */ '../views/sys-admin/temp/AttributeListView')
      }
    ]
  },

  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },

  {
    path: '/login',
    component: () => import(/* webpackChunkName: "about" */ '../views/LoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
